<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- 阻止冒泡 -->
      <div class="box" @click="boxClick">
        <button @click.stop="btnClick">cm</button>
      </div>
      <!-- 阻止默认事件 -->
      <form action="#">
        <input type="submit" value="tijiao" @click.prevent="doSubmit">
      </form>
      <a href="#" @click.prevent="aClick">a</a>
      <button @click.once="btnClick">cm</button>

      <!-- 键盘修饰符事件 -->
      <input type="text" @keyup="getMsg">
      <input type="text" @keyup.enter="getMsg">
    </div>

    <script src="../js/vue.js"></script>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            msg: "tdsx"
          }
        },
        methods: {
          boxClick(){            
            console.log('点击了盒子');
          },
          btnClick(event){
            console.log('点击了按钮');
          },
          doSubmit(event){
            console.log('表单提交');
          },
          aClick(){
            console.log('点击了a标签');
          },
          getMsg(event){
            console.log(
              event
            );
          }

        },
      }).mount("#app");
    </script>
  </body>
</html>